package com.example.mywechatprogram.mapper;

import com.example.mywechatprogram.entity.Word;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface ExamMapper {
    @Insert("insert exam (word_id,users_UUID,word) values(#{id},#{users_UUID},#{word})")
    int add(@Param("users_UUID") String userId, @Param("word") String word, @Param("id") int word_id);

    @Select("Select word,word_id from exam where users_UUID=#{UUID}")
    List<Word> request(@Param("UUID") String userId);

    @Delete("delete from exam where users_UUID=#{UUID} and word_id=#{word_id}")
    int del(@Param("UUID") String userId,@Param("word_id") int word_id);

    @Select("select word,word_id from words order by rand() limit 3")
    List<Word> get3();

//    @Select("select word,word_id from Exam where users_UUID=#{UUID} and word_id")
//    Word requestWord(@Param("UUID") String userId,@Param("word_id") int word_id);
}
